package com.gxa.eurekaclient.service;

import com.gxa.eurekaclient.pojo.YongHu;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.HashMap;
import java.util.Map;

/**
 * @author thinknovo
 * @version 1.0
 * @description JueSeService.java
 * @date 2021/1/5 10:26
 */
@Service
public class YongHuService {

    @Resource
    private RedisTemplate redisTemplate;

    public Map<String, Object> selectAll(String yongHuMingCheng) {
        Map<String, Object> map = new HashMap<>();
        try {
            Object obj = redisTemplate.opsForValue().get(yongHuMingCheng);
            map.put("code", 200);
            map.put("msg", "查询成功");
            map.put("username", obj);
        } catch (Exception e) {
            e.printStackTrace();
            map.put("code", 100200);
            map.put("msg", "查询失败！");
        }
        return map;
    }

}
